#ifndef SOLUTION_H_
#define SOLUTION_H_
class Solution 
{
public:
    int jump(int A[], int n) 
	{
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
		if(n <= 1)
			return 0;
        int steps = 0, idx =0;
		while(idx < n)
		{
			int curMax = A[idx] + idx;
			steps++;

			if(curMax >= (n-1))
				return steps;

			int tmpMax = curMax;
			for(int j=idx+1;j<=curMax;j++)
			{
				if((A[j]+j) > tmpMax)
				{
					tmpMax = A[j]+j;
					idx = j;
				}
			}
		}

		return steps;
    }
};
#endif